﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CommunityToolkit.Mvvm.ComponentModel;

namespace App2Wpf
{
    public enum ClipboardMode
    {
        Disabled = 1,
        Receive = 2,
        Send = 3,
        Both = 4,
    }

    enum ProtocolCommand
    {
        Success = 1,
        Fail = 2,
        RequestSession = 3,
        AttachToSession = 4,
        BadRequest = 5,
        ResourceFound = 6,
        ResourceNotFound = 7,
        LogonUIAccessDenied = 8,
        LogonUIWrongSession = 9,
    }

    public enum WorkerKind
    {
        Desktop = 1,
        Events = 2,
    }

    public enum BlockSize
    {
        Size32 = 32,
        Size64 = 64,
        Size96 = 96,
        Size128 = 128,
        Size256 = 256,
        Size512 = 512,
    }

    public enum PacketSize
    {
        Size1024 = 1024,
        Size2048 = 2048,
        Size4096 = 4096,
        Size8192 = 8192,
        Size9216 = 9216,
        Size12288 = 12288,
        Size16384 = 16384,
    }

    enum InputEvent
    {
        KeepAlive = 0x1,
        MouseCursorUpdated = 0x2,
        ClipboardUpdated = 0x3,
        DesktopActive = 0x4,
        DesktopInactive = 0x5,
    }

    public enum OutputEvent
    {
        Keyboard = 0x1,
        MouseClickMove = 0x2,
        MouseWheel = 0x3,

        KeepAlive = 0x4,
        ClipboardUpdated = 0x5,
    }

    public enum MouseState
    {
        Up = 0x1,
        Down = 0x2,
        Move = 0x3,
    }

    enum CursorType
    {
        IDC_APPSTARTING,
        IDC_ARROW,
        IDC_CROSS,
        IDC_HAND,
        IDC_HELP,
        IDC_IBEAM,
        IDC_ICON,
        IDC_NO,
        IDC_SIZE,
        IDC_SIZEALL,
        IDC_SIZENESW,
        IDC_SIZENS,
        IDC_SIZENWSE,
        IDC_SIZEWE,
        IDC_UPARROW,
        IDC_WAIT,
    }

    public class nameip :ObservableObject
    {
        public int no { get; set; }
        public string name { get; set; }
        public string ip { get; set; }


    }

    class SEvent
    {
        public InputEvent Id { get; set; }
        public CursorType Cursore { get; set; }
        public string Text { get; set; }
    }

    public static class Map
    {
        public static readonly Dictionary<int, string> funcKeymap = new Dictionary<int, string>
        {
            { 91,"^{ESC}" },
            { 92,"{WIN}" },

            { 112,"{F1}" },
            { 113,"{F2}" },
            { 114,"{F3}" },
            { 115,"{F4}" },
            { 116,"{F5}" },
            { 117,"{F6}" },
            { 118,"{F7}" },
            { 119,"{F8}" },
            { 120,"{F9}" },
            { 121,"{F10}" },
            { 122,"{F11}" },
            { 123,"{F12}" },
            { 124,"{F13}" },
            { 125,"{F14}" },
            { 126,"{F15}" },
            { 127,"{F16}" },

            { 37,"{LEFT}" },
            { 38,"{UP}" },
            { 39,"{RIGHT}" },
            { 40,"{DOWN}" },

            { 27,"{ESC}" },
            { 33,"{PGUP}" },
            { 34,"{PGDW}" },
            { 35,"{HOME}" },
            { 36,"{DELETE}" },
            { 46,"{END}" },

        };

        public static int[] WPF_FuncKeyList = new int[] {
            90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,   ////F1 - - F16

            23,24,25,26, //// left up right down
            //19, 20,    ////  PGUP PGDW
            21, 22,         //// -----  END HOME
            32,              ////Delete = 32,
            ///// 0123456789 ABCD..XYZ
            34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69

        };

        public static string[] simulateSendKeyMapList = new string[]
        {
             "{ESC}","", "{F1}", "{F2}", "{F3}", "{F4}", "{F5}", "{F6}", "{F7}", "{F8}", "{F9}", "{F10}", "{F12}", "{F11}", "{F9}", "{F10}", "{F11}", "{F12}",
        "{ENTER}"
            ,"{DELETE}", "{HOME}", "{END}", "{END}", "`","1","2","3","4","5","6","7","8","9","0","-","=","",
            "{TAB}","q","w","e","r","t","y","u","i","o","p","{[}","{]}","\\",
            "{CAPSLOCK}","A ","S ","D ","F ","G ","H ","J ","K ","L ","; ","'",
            "a ","s ","d ","f ","g ","h ","j ","k ","l ","; ","'",
            "{LSHIFT}","z ","x ","c ","v ","b ","n ","m ",",","."," / ","{RSHIFT}",
            " ^{ ESC}",
            " "," ", "{ PGUP}", "{ PGDW}", "{ UP}", "{ DOWN}", "{ LEFT}", "{ RIGHT}",
            "!","@","#","$","{%}","{^}","&","*","{(}","{)}","_","{+}",
             "{ ~}",

                "{ { } ", "{ } }", " | ", ":", "\"", "<",">","?"
        };

        /// <summary>
        /// 组合按键输入的 文字字符字典   //无法热重载
        /// </summary>
        public static readonly Dictionary<string, string> WPF_TextKeyMap = new Dictionary<string, string>
        {
            //// sendkey 模拟字符
            { "[","{[}" },
            { "]","{]}" },
            { "=","=" },
            { "-","{-}" },
            { "\\","{\\}" },
            { ";","{;}" },
            { "'","{'}" },
            { ",","{,}" },
            { ".","{.}" },
            { "/","{/}" },
            { "`","{`}"},

            { "1","1" },
            { "2","2" },
            { "3","3" },
            { "4","4" },
            { "5","5" },
            { "6","6" },
            { "7","7}" },
            { "8","8" },
            { "9","9" },
            { "0","0" },

            


            ////组合按键输入的 字符
            { "~","{~}" },
            {"!","!"},
            {"@","@"},
            {"#","#"},
            {"$","$"},
            { "%","{%}" },
            { "^","{^}" },
            {"&","&"},
            {"*","*"},
            { "(","{(}" },
            { ")","{)}" },
            {"_","_"},
            { "+","{+}" },
            { "{","{{}" },
            { "}","{}}" },
            {"|","|"},
            {":",":"},
            {"\"","\""},
            {"<","<"},
            {">",">"},
            {"?","?"},

            //// 中文状态下
            //{"·","`"},
            //{"！","!"},

            //{"￥","￥"},

            //{ "……","{^}" },
 
            //{ "（","{(}" },
            //{ "）","{)}" },
            //{"——","_"},
            //////
            //{ "【","{[}" },
            //{ "】","{]}" },

            //{"；",":"},

            //{"‘","\""},
            //{"’","\""},
            //{"“","\""},
            //{"”","\""},
            //{"《","<"},
            //{"》",">"},

            //{"、","/"},
            //{"？","?"},
            //{"，",","},
            
        };

    }
}
